/**
 * 
 */
package com.primestone.cim.meterreadings.beans;

import java.io.Serializable;
import java.util.List;

import javax.xml.datatype.XMLGregorianCalendar;

import ch.iec.tc57._2011.schema.message.OptionType;

import com.primestone.cim.util.StringUtil;

/**
 * @author cesar.mateus
 *
 */
public class Param implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4128866815508856594L;
	
	private XMLGregorianCalendar startTime;
	private XMLGregorianCalendar endTime;
	private String descVar = null;
	private String varType = null;
	private String client = null;
	private String uom = null;
	private String channel = null;
	private String interval = null;
	private String ke = null;
	private String usagedata = null;
	
	/**
	 * @param startTime
	 * @param endTime
	 * @param options
	 */
	public Param(XMLGregorianCalendar startTime, XMLGregorianCalendar  endTime, List<OptionType> options) {
		this.startTime = startTime;
		this.endTime = endTime;
		
		for (OptionType option : options) {
			if (option.getName().equals(StringUtil.VAR_FIELD_NAME)) {
				this.descVar = option.getValue();
			} else if (option.getName().equals(StringUtil.VARTYPE_FIELD_NAME)) {
				this.varType = option.getValue();
			} else if (option.getName().equals(StringUtil.CLIENT_FIELD_NAME)) {
				this.client = option.getValue();
			} else if (option.getName().equals(StringUtil.UOM_FIELD_NAME)) {
				this.uom = option.getValue();
			} else if (option.getName().equals(StringUtil.CHANNEL_FIELD_NAME)) {
				this.channel = option.getValue();
			} else if (option.getName().equals(StringUtil.INTERVAL_FIELD_NAME)) {
				this.interval = option.getValue();
			} else if (option.getName().equals(StringUtil.KE_FIELD_NAME)) {
				this.ke = option.getValue();
			} else if (option.getName().equals(StringUtil.USAGEDATA_FIELD_NAME)) {
				this.usagedata = option.getValue();
			}
		}
	}

	/**
	 * @return the startTime
	 */
	public XMLGregorianCalendar getStartTime() {
		return this.startTime;
	}
	/**
	 * @param startTime the startTime to set
	 */
	public void setStartTime(XMLGregorianCalendar startTime) {
		this.startTime = startTime;
	}
	/**
	 * @return the endTime
	 */
	public XMLGregorianCalendar getEndTime() {
		return this.endTime;
	}
	/**
	 * @param endTime the endTime to set
	 */
	public void setEndTime(XMLGregorianCalendar endTime) {
		this.endTime = endTime;
	}
	
	/**
	 * @return the descVar
	 */
	public String getDescVar() {
		return this.descVar;
	}
	/**
	 * @param descVar the descVar to set
	 */
	public void setDescVar(String descVar) {
		this.descVar = descVar;
	}
	/**
	 * @return the varType
	 */
	public String getVarType() {
		return this.varType;
	}
	/**
	 * @param varType the varType to set
	 */
	public void setVarType(String varType) {
		this.varType = varType;
	}
	/**
	 * @return the client
	 */
	public String getClient() {
		return this.client;
	}
	/**
	 * @param client the client to set
	 */
	public void setClient(String client) {
		this.client = client;
	}
	/**
	 * @return the uom
	 */
	public String getUom() {
		return this.uom;
	}
	/**
	 * @param uom the uom to set
	 */
	public void setUom(String uom) {
		this.uom = uom;
	}
	/**
	 * @return the channel
	 */
	public String getChannel() {
		return this.channel;
	}
	/**
	 * @param channel the channel to set
	 */
	public void setChannel(String channel) {
		this.channel = channel;
	}
	
	/**
	 * @return the intChannel
	 */
	public Integer getIntChannel() {
		if (StringUtil.safe(getChannel())) {
			return Integer.valueOf(getChannel());
		}
		return null;
	}
	
	/**
	 * @return the interval
	 */
	public String getInterval() {
		return this.interval;
	}
	
	/**
	 * @param interval the interval to set
	 */
	public void setInterval(String interval) {
		this.interval = interval;
	}
	
	/**
	 * @return the intInterval
	 */
	public Integer getIntInterval() {
		if (StringUtil.safe(getInterval())) {
			return Integer.valueOf(getInterval());
		}
		return null;
	}
	
	/**
	 * @return the ke
	 */
	public String getKe() {
		return this.ke;
	}
	/**
	 * @param ke the ke to set
	 */
	public void setKe(String ke) {
		this.ke = ke;
	}
	
	/**
	 * @return the floatKe
	 */
	public Float getFloatKe() {
		if (StringUtil.safe(getKe())) {
			return Float.valueOf(getKe());
		}
		return null;
	}
	
	/**
	 * @return the usagedata
	 */
	public String getUsagedata() {
		return this.usagedata;
	}
	/**
	 * @param usagedata the usagedata to set
	 */
	public void setUsagedata(String usagedata) {
		this.usagedata = usagedata;
	}
	
	/**
	 * @return the floatUsagedata
	 */
	public Float getFloatUsagedata() {
		if (StringUtil.safe(getUsagedata())) {
			return Float.valueOf(getUsagedata());
		}
		return null;
	}

}
